package day04;
public class ExtendsVSInterface {
    public static void main(String[] args) {
        littleMonkey littleMonkey = new littleMonkey("悟空");
        littleMonkey.fly();
        littleMonkey.swim();
        littleMonkey.climbing();
    }
}
class Monkey{
    private String name;
    public void climbing(){
        System.out.println(name+"天生就会爬树");
    }
    public Monkey(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }
}
class littleMonkey extends Monkey implements Fly,Swim{//这个时候小猴子已经继承了父亲的爬树能力
    public littleMonkey(String name) {
        super(name);
    }

    @Override
    public void fly() {
        System.out.println(getName()+"通过后天的努力正在学习飞翔");
    }

    @Override
    public void swim() {
        System.out.println(getName()+"通过后天的努力正在学习水下功夫");
    }
}
interface Fly{
    void fly();
}
interface Swim{
    void swim();
}
